package com.czy.daishusys.adapter;

import android.widget.ImageView;

import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.czy.daishusys.R;
import com.czy.daishusys.entity.ConstantsModel;
import com.czy.daishusys.entity.ShareContactsBean;
import com.czy.daishusys.utils.PhoneUtils;
import com.czy.daishusys.utils.glide.GlideUtils;

import java.util.List;

import de.hdodenhof.circleimageview.CircleImageView;

/**
 * https://github.com/CymChad/BaseRecyclerViewAdapterHelper
 */
public class MailListAdapter extends BaseQuickAdapter<ConstantsModel, BaseViewHolder> {
    public MailListAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ConstantsModel shareContactsBean) {
        helper.setText(R.id.tv_user_name, shareContactsBean.getStoreName());
        helper.setText(R.id.tv_user_phone, shareContactsBean.getPhone());
        CircleImageView tv_remarks = (CircleImageView) helper.itemView.findViewById(R.id.img_header_view);
//        helper.setImageResource(R.id.icon, shareContactsBean.getPhone());
        helper.addOnClickListener(R.id.relat_content).addOnClickListener(R.id.bt_call_phone).addOnClickListener(R.id.bt_send_message);
        //添加数据
        GlideUtils.loadImage(mContext, shareContactsBean.getStroeLogo(), tv_remarks, new GlideUtils.ImageLoadListener<String, GlideDrawable>() {
            @Override
            public void onLoadingComplete(String uri, ImageView view, GlideDrawable resource) {

            }

            @Override
            public void onLoadingError(String source, Exception e) {

            }
        }, R.mipmap.ic_message_head_sto, R.mipmap.ic_message_head_sto);
    }
}
